﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using ServicesComponent.Repositories.Core;
using Business_Objects;
using Data_Objects;
namespace ServicesComponent.Repositories
{
    ///// <summary>
    ///// DiemDanh Repository. Good example of CRUD operations.
    ///// </summary>
    public class DiemDanhRepository : IDiemDanhRepository
    {
        private static readonly IDiemDanhDao _diemDanh = DataAccess.DiemDanhDao;
        public List<DiemDanh> GetList()
        {
            return _diemDanh.GetDiemDanh().ToList();
        }

        public DiemDanh Get(string id)
        {
            return _diemDanh.GetDiemDanhByID(id);
        }

        public void Insert(DiemDanh t)
        {
            _diemDanh.InsertDiemDanh(t);
        }

        public void Update(DiemDanh t)
        {
            _diemDanh.UpdateDiemDanh(t);
        }

        public void Delete(DiemDanh t)
        {
            _diemDanh.DeleteDiemDanh(t);
        }

        public List<DiemDanh> GetDiemDanhBySchoolIdAndSchoolYear(string SchoolYearID, int schoolId)
        {
            return _diemDanh.GetDiemDanhBySchoolIdAndSchoolYear(SchoolYearID, schoolId);
        }


        public DiemDanh GetDiemDanhBySchoolIdAndSchoolYearAndStudentId(string SchoolYearID, int schoolId, string studentId)
        {
            return _diemDanh.GetDiemDanhBySchoolIdAndSchoolYearAndStudentId(SchoolYearID, schoolId, studentId);  
        }


        public List<DiemDanh> GetBienLaiThuByClassIdAndSchoolSchoolYear(string schoolYearID, int schoolId, string classId)
        {
            return _diemDanh.GetBienLaiThuByClassIdAndSchoolSchoolYear(schoolYearID, schoolId, classId);
        }
    }
}